$(function(){
    /*导航*/
    $('.nav').children('li').mouseenter(function(){
        $(this).addClass('over')
    }).mouseleave(function(){
        $(this).removeClass('over')
    })

    $('.teach').mouseenter(function(){
        $('.slidNav1').stop().slideDown(800)
    }).mouseleave(function(){
        $('.slidNav1').stop().slideUp(500)
    })

    $('.more').mouseenter(function(){
        $('.slidNav2').stop().slideDown(800)
    }).mouseleave(function(){
        $('.slidNav2').stop().slideUp(500)
    })

    //屏幕滚动
    $(window).scroll(function(){
        // console.log($(document).scrollTop());
        if($(document).scrollTop()>0){
            $('.navCont').css({"padding-top":"0",'background':'#fff'});
            $('.nav').children('li').children('a').css('color','#000')
            $('.logo').css({'color':'#000','font-size':'24px','line-height':'50px'});
            $('.menu').addClass('checkMenu')
        }else{
            $('.navCont').css({"padding-top":"10px",'background':'transparent'})
            $('.nav').children('li').children('a').css('color','#fff');
            $('.logo').css({'color':'#fff','font-size':'38px'});
            $('.menu').removeClass('checkMenu')
        }
    })
    /*功能特色调用接口*/
    $.ajax({
        url:"https://mock.mengxuegu.com/mock/62a1a93dee30d248b590f1e2/svnBucket/feature",
        type:"post",
        dataType:"json",
        success:function(res){
            // console.log(res)
            $.each(res,function(index,value){
                $('.funCont').append("<div class='fun col-lg-6 clo-xs-12'><img src='"+value.imgSrc+"'><div class='funText'><p>"+value.title+"</p><p>"+value.context+"</p></div></div>")
            })
        },
        error:function(res){
            console.log(res)
        }
    })
    /*项目管理等*/
    $.ajax({
        url:"https://mock.mengxuegu.com/mock/62a1a93dee30d248b590f1e2/svnBucket/items",
        type:"post",
        dataType:"json",
        success:function(res2){
            // console.log(res2)
            $.each(res2,function(index,val){
                // console.log(index%2)
                if(index==0){
                    // console.log(index)
                    $('.itBg0').html('<div class="container itC"><div class="itCont col-lg-4"><h1>'+val.title+'</h1><p>'+val.context+'</p></div><div class="col-lg-8 col-xs-12"><img src="'+val.imgSrc+'"></div></div>')
                }
                if(index==1){
                    // console.log(index)
                    $('.itBg1').html('<div class="container itC"><div class="col-lg-8 col-xs-12"><img class="col-lg-8" src="'+val.imgSrc+'"></div><div class="itCont col-lg-4"><h1>'+val.title+'</h1><p>'+val.context+'</p></div></div>')
                }
                if(index==2){
                    $('.itBg2').html('<div class="container itC"><div class="itCont col-lg-4"><h1>'+val.title+'</h1><p>'+val.context+'</p></div><div class="col-lg-8 col-xs-12"><img src="'+val.imgSrc+'"></div></div>')
                }
                if(index==3){
                    $('.itBg3').html('<div class="container itC"><div class="col-lg-8 col-xs-12"><img src="'+val.imgSrc+'"></div><div class="itCont col-lg-4"><h1>'+val.title+'</h1><p>'+val.context+'</p></div></div>')
                }
                if(index==4){
                    $('.itBg4').html('<div class="container itC"><div class="itCont col-lg-4"><h1>'+val.title+'</h1><p>'+val.context+'</p></div><div class="col-lg-8 col-xs-12"><img src="'+val.imgSrc+'"></div></div>')
                }
            })
        },
        error:function(res2){
            console.log(res2)
        }
    })

    //移动端导航
    $('#mobile').click(function(){
        $('.mobileNav').animate({'right':'0px'},500)
    })
    $('#flod').click(function(){
        $('.mobileNav').animate({'right':'-200px'},500)
    })
    $('#itmesList').mouseenter(function(){
        $(this).addClass('divShow')
    }).mouseleave(function(){
        $(this).removeClass('divShow')
    })
})